﻿#ifndef MSGSOCKET_H
#define MSGSOCKET_H

#include <QObject>
#include <QTcpSocket>
#include "globalvars.h"
//#include <QMap>

class MsgSocket : public QObject
{
    Q_OBJECT

public slots:
    void slotReadyRead();
    bool slotSendMsg(QString msg);

public:
    explicit MsgSocket(QTcpSocket *socket, QObject *parent = nullptr);
    ~MsgSocket();
    QTcpSocket *m_tcpSocket;
private:
    quint16 m_tcpBlockSize;

};



#endif // MSGSOCKET_H
//signals:
//    void signalRegisterSocket(QString id, MsgSocket *socket);//建立连接时发送信号，保存到map中
//    void signalLogoutSocket(QString id, MsgSocket *socket);//关闭连接时发送信号，从map中删除
//    void parseUserLogin(QString msg);
//    void parseUserExit(QString msg);
//    QString m_localUid;
//typedef QMap<QString, MsgSocket*> SocketMap;//id, socket
